package com.taogewan.af;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button btnJumpToFlutter = findViewById(R.id.btn_jump_to_flutter);
        btnJumpToFlutter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, FlutterPageActivity.class);
                startActivity(intent);
            }
        });

        findViewById(R.id.btn_jump_to_flutter2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(
                        FlutterActivity
                                .withNewEngine()
                                .initialRoute("route1")
                                .build(MainActivity.this)
                );
            }
        });
    }
}
